#include "pixmapwidget.h"
#include <QPainter>
PixmapWidget::PixmapWidget(QWidget *parent, const QPixmap &pixmap)
    : TTKGrabItemWidget(parent), m_pixmap(pixmap)
{

}

void PixmapWidget::paintEvent(QPaintEvent *event)
{
    TTKGrabItemWidget::paintEvent(event);
    QPixmap pix = m_pixmap.scaled(size() - QSize(5,5), Qt::IgnoreAspectRatio,
                                    Qt::SmoothTransformation);
    QPainter painter(this);
    painter.drawPixmap(2, 2, pix.width(), pix.height(), pix);
//    painter.setBrush(QColor(255, 255, 255, 100));
//    painter.drawRect(0, 0, m_pixmap.width(), m_pixmap.height());
//    painter.drawPixmap(100, 0, m_pixmap.width(), m_pixmap.height(), m_pixmap);
//    painter.setBrush(QColor(0, 0, 255, 100));
//    painter.drawRect(100, 0, m_pixmap.width(), m_pixmap.height());
}
